<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('admin_notifications', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedInteger('admin_id')->comment('管理员ID');
            $table->unsignedTinyInteger('level')->nullable()->comment('消息等级');
            $table->string('title')->nullable()->comment('消息标题');
            $table->text('content')->nullable()->comment('消息内容');
            $table->tinyInteger('state')->nullable()->default(0)->comment('阅读状态');
            $table->dateTime('read_at')->nullable()->comment('阅读时间');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('admin_notifications');
    }
};
